-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add pydbus stubs #13921
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add pydbus stubs #13921
Conversation
a4baf4d
to
d4870ab
Compare
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, not a full review, but two things I noticed:
You are using Any
in many places, where a proper type could be substituted. In those cases, either remove the type annotation or use Incomplete
from _typeshed
where removing it would not work properly (for example, because Any
is used in a union). In all remaining cases, Any
needs to documented with the accepted or possible types and the reason for using Any
.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
50cc2d0
to
1b118a4
Compare
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Looks mostly good, a few remarks below.
Co-authored-by: Sebastian Rittau <[email protected]>
Co-authored-by: Sebastian Rittau <[email protected]>
Co-authored-by: Sebastian Rittau <[email protected]>
Co-authored-by: Sebastian Rittau <[email protected]>
This comment has been minimized.
This comment has been minimized.
LGTM, but we need to find out why CI fails. I think it's because PyGObject-stubs doesn't declare a dependency on pygobject. Until someone beats me to it, I will investigate more tomorrow. You could try to add a |
This comment has been minimized.
This comment has been minimized.
@Tatsh Ok, I got stubtest running properly by adding some APT dependencies. But now there are a few proper stubtest complaints. Could you have a look? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I would prefer to not export |
This comment has been minimized.
This comment has been minimized.
stubs/pydbus/pydbus/proxy.pyi
Outdated
class ProxyMixin(Generic[_T]): | ||
def get(self, bus_name: str, object_path: str | None = None, *, timeout: int | None = None) -> _CompositeObject[_T]: ... | ||
@type_check_only | ||
class OrgBluezAdapter1Dict(TypedDict, total=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry I didn't notice this earlier, but type check only types should be prefixed with _
, e.g. _OrgBluezAdapter1Dict
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to add # noqa: Y049
for these types. Ruff does not see these as used even though they are getting passed into TypedDict()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do I fix this issue? https://github.com/python/typeshed/actions/runs/14883678415/job/41797568758?pr=13921#step:5:317
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add it to the stubtest allowlist
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
https://github.com/LEW21/pydbus/tree/master/pydbus
Upstream is extremely sporadic and currently not active.
In
bus.pyi
there are overloads for org.bluez and org.freedesktop.Notifications.